<div class="wrapper">
    <!--头部导航-->
    <header id="head">
        <div class="sui-navbar">
            <div class="navbar-inner">
                <a href="/" class="sui-brand"><img src="./img/asset-logo-black.png" alt="社交"/></a>
                <ul class="sui-nav">
                    <li><a href="/">头条</a></li>
                    <li><a href="./qa-logined.html">问答</a></li>
                    <li class="active"><a href="./activity-index.html">活动</a></li>
                    <li><a href="/">交友</a></li>
                    <li><a href="./spit-index.html">吐槽</a></li>
                    <li><a href="/">招聘</a></li>
                </ul>
                <form class="sui-form sui-form pull-left">
                    <input type="text" placeholder="输入关键词..."/>
                    <span class="btn-search fa fa-search"></span>
                </form>

                <div  class="sui-nav pull-right info" v-if="username">
                    <li><a href="./other-notice.html" target="_blank" class="notice">通知</a></li>
                    <li class="hover"><span class="fa fa-plus "></span>
                        <ul class="hoverinfo">
                            <li><i class="fa fa-share-alt" aria-hidden="true"></i> <a
                                    href="./headline-submit.html">去分享</a>
                            </li>
                            <li><i class="fa fa-question-circle" aria-hidden="true"></i> <a href="./qa-submit.html"
                                                                                            target="_blank">提问题</a>
                            </li>
                            <li><i class="fa fa-comments" aria-hidden="true"></i><a href="./spit-submit.html"
                                                                                    target="_blank">去吐槽</a></li>
                            <li><i class="fa fa-heartbeat" aria-hidden="true"></i> <a
                                    href="./makeFriends-submit.html" target="_blank">发约会</a></li>
                        </ul>
                    </li>
                    <li><a href="./person-homepage.html" target="_blank" class="homego"><img
                            src="./img/widget-photo.png" alt="用户头像"/></a></li>
                </div>
                <div  class="sui-nav pull-right info" v-else>
                    <li><a href="./person-loginsign.html" target="_blank">注册</a></li>
                    <li><a :href="'./person-loginsign.html?next=' + next_url" target="_blank" @click="get_next"
                           class="sui-btn btn-login">登录</a></li>
                </div>
            </div>
        </div>
    </header>
</div>

<script>
    let head = new Vue({
        el: "#head",
        data: {
            login: true,
            next_url: '',
            username: sessionStorage.username || localStorage.username,
            user_id: sessionStorage.user_id || localStorage.user_id,
            token: sessionStorage.token || localStorage.token,
        },
        mounted: function () {
            // 一加载就需要做的，直接是代码

        },
        methods: {
            // 需要用到的函数，键值对 ，键是名称，值是匿名函数
            get_next: function () {
                // var re = /^\/(\w+).html$/;
                // console.log(document.location.pathname);
                // console.log(document.location.pathname.match(re));
                this.next_url = document.location.pathname;
                console.log(this.next_url)

            },
        }
    })
</script>

